package com.myjob;

import com.myjob.common.MyConfig;
import com.nhn.android.maps.NMapActivity;
import com.nhn.android.maps.NMapController;
import com.nhn.android.maps.NMapView;
import com.nhn.android.maps.nmapmodel.NMapError;
import com.nhn.android.maps.nmapmodel.NMapPlacemark;

import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;

public class NMapTest extends NMapActivity {

	private NMapView mMapView;
	private NMapController mMapNMapController;
	private TextView tv1;
	
	private final double FIX_LATITUDE = 37.508707;
	private final double FIX_LONGITUDE = 127.038107;
	
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
	    super.onCreate(savedInstanceState);
	    setContentView(R.layout.test_step1);
	    
	    mMapView = new NMapView(this);
	    mMapView.setApiKey(MyConfig.API_KEY);
	    
	    tv1 = (TextView)findViewById(R.id.test_step1_TV1);
	    
	    super.setMapDataProviderListener(onDataProviderListener);
	    findPlacemarkAtLocation(FIX_LONGITUDE, FIX_LATITUDE);
	    
	}
	
	private final NMapActivity.OnDataProviderListener onDataProviderListener = new NMapActivity.OnDataProviderListener() {
		
		@Override
		public void onReverseGeocoderResponse(NMapPlacemark placeMark, NMapError errorInfo) {
			if(errorInfo != null){
				Log.e(MyConfig.DBG_LOG, "Failed to findPlacemarkAtLocation : " + errorInfo.toString());
				return ;
			}
			
			Log.i(MyConfig.DBG_LOG, placeMark.toString());
			tv1.setText(placeMark.toString());
		}
	};

}
